local skill = fk.CreateSkill {
  name = "kill_demon_skill",
}

Fk:loadTranslationTable{
  [":kill_demon_skill"] = "对体力上限最大的角色造成1点伤害，扣减其1点体力上限",
  ["#kill_demon_skill"] = "对体力上限最大的角色造成1点伤害，扣减其1点体力上限",
}

skill:addEffect("cardskill", {
  prompt = "#kill_demon_skill",
  target_num = 1,
  mod_target_filter = function(self, player, to_select)
    local max = 0
    for _, p in ipairs(Fk:currentRoom().alive_players) do
      max = math.max(max, p.maxHp)
    end
    return to_select.maxHp == max
  end,
  target_filter = Util.CardTargetFilter,
  on_effect = function(self, room, effect)
    local player = effect.from
    local target = effect.to
    room:damage({
      from = player,
      to = target,
      card = effect.card,
      damage = 1,
      skillName = self.name,
    })
    room:changeMaxHp(target, -1)
    local cards = room:getSubcardsByRule(effect.card, { Card.Processing })
    if #cards > 0 then
      room:moveCards({
        ids = cards,
        toArea = Card.Void,
        moveReason = fk.ReasonJustMove,
        proposer = effect.from,
        skillName = self.name,
      })
    end
  end,
})

return skill
